

#include <any>
#include <iostream>
#include <string>

void test_case() {

    std::any a;
    std::any b = 4.3;

    std::cout << "a.has_value " << a.has_value() << std::endl;
    std::cout << "b.has_value " << b.has_value() << std::endl;

    a = 42;
    b = std::string {"hi"};

    if (a.type() == typeid(std::string)) {

    } else if (a.type() == typeid(int)) {
        int x = std::any_cast<int>(a);
        std::cout << "x value: " << x << std::endl;
    }
}

int main() {

    test_case();
    return 0;
}